<?
session_start();
require_once("_mailing_libs.php");
check_session("/mailing/mailing_manager.php");

$conn = mysql_connect("db.fittiche.com", "woodstock", "whoareyou") or die("Can't connect: " . mysql_error());
mysql_select_db("woodstock_prototype") or die("Can't select database");

$sql = "SELECT * FROM mailing_list WHERE status = 'active'";
$rs = mysql_query($sql) or die("SQL operation failed: " . mysql_error());
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<h1>Woodstock mailing list</h1>
<a href="mailing_excelsheet.php">download</a>
<a href="mailing_logout.php">logout</a>
<form name="mailing_list" method="post" action="">
<table>
	<tr>
		<th>email_address</th>	<th>name</th>	<th>status</th>	<th>join date</th>	<th>action1</th>
	</tr>
<?
while ($row = mysql_fetch_row($rs)) {
	echo "\t<tr>\n";
	echo "\t\t<td>$row[1]</td>\n";
	echo "\t\t<td>$row[2]</td>\n";
	echo "\t\t<td class=\"$row[3]\">$row[3]</td>\n";
	echo "\t\t<td>$row[4]</td>\n";
	echo "\t\t<td><a href=\"/mailing/_mailing_remove.php?id=$row[0]\">remove</a></td>\n";
	echo "\t</tr>\n";
}
?>
</table>
</form>
</body>
</html>
<?
mysql_free_result($rs);
mysql_close($conn);
?>
